import React, { Component } from 'react'

export default class Input extends Component {
    state = {
        name: "1",
        flag: false
    }
    render() {
        const { name, flag } = this.state
        return (
            <div>
                {/* 姓名：<input value = { name } onChange = {(ev) => {
                    // ev  事件对象
                    this.setState({
                        name: ev.target.value
                    })
                }} type="text" /> */}

                <input checked = { flag } onChange = {(ev) => {
                    this.setState({
                        flag: ev.target.checked
                    })
                }} type="checkbox" />
                <div>
                    <button onClick = {() => {
                        alert(flag)
                    }}>提交</button>
                </div>
            </div>
        )
    }
}
